clang-tidy modernize-use-auto, part 2, but (#485)
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Thu, 30 Jan 2020 17:30:37 +0000 (10:30 -0700)
committerGitHub <noreply@github.com>
Thu, 30 Jan 2020 17:30:37 +0000 (10:30 -0700)
commitbb78b6d4f534e2edccd9a272fb89a76bddfb7a61
tree8a0d4ffc649652a0ad35408ab702df489c6b0f3a
parent542fa122424368d19c5c081c0e15d9e57ddf9e44
clang-tidy modernize-use-auto, part 2, but (#485)

* clang-tidy modernize-use-auto, part 2, but

only on:
Message: use auto when initializing with a cast to avoid duplicating the type name

not on:
Message: use auto when initializing with new to avoid duplicating the type name
Message: use auto when initializing with a template cast to avoid duplicating the

Before running clang-tidy gbfile.h was changed to replace the macro definition of
gbfopen_le, gbfgetuint32, gbfgetuint16, gbfputuint16, gbfputuin32 with inline
function definitions.  Without this change the application of modernize-use-auto
made it difficult to recognize the type of the result. Note this change has merit
of it's own,
see https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-macros

This was run with clang-tidy from llvm version 8.  It generate serveral
compilation errors that will be fixed by hand in the next commit.

* fix errors introduced by clang-tidy modernize-use-auto.

These errors are of the form:
error: variable 'myvar' declared with deduced type 'auto *' cannot appear in its own initializer
They arose from patterns like:
mytype* myvar = (mytype*) xcalloc(1, sizeof(*myvar));
which clang-tidy changed to
auto* myvar = (mytype*) xcalloc(1, sizeof(*myvar));

These were edited by hand to the form
auto* myvar = (mytype*) xcalloc(1, sizeof(mytype));

At the same time, the order of the parameters in calls to
xcalloc was corrected.
47 files changed:
alan.cc
an1.cc
arcdist.cc
cet.cc
dg-100.cc
discard.cc
duplicate.cc
explorist_ini.cc
garmin_gpi.cc
garmin_xt.cc
gbfile.cc
gbfile.h
gbser_posix.cc
gdb.cc
ggv_log.cc
globalsat_sport.cc
gnav_trl.cc
holux.cc
humminbird.cc
igo8.cc
jeeps/gpssend.cc
jeeps/gpsserial.cc
jeeps/gpsusbcommon.cc
kml.cc
lowranceusr.cc
mkshort.cc
mmo.cc
naviguide.cc
navilink.cc
netstumbler.cc
osm.cc
ozi.cc
radius.cc
raymarine.cc
reverse_route.cc
saroute.cc
sbn.cc
skytraq.cc
src/core/usasciicodec.cc
swapdata.cc
tomtom.cc
tpg.cc
tpo.cc
util.cc
vitosmt.cc
wbt-200.cc
xmltag.cc